﻿using System;

namespace Program17
{
    internal class Program
    {
        //定义一个委托
        public delegate void SayHi(string name);

        private static void Main(string[] args)
        {
            //调用中文打招呼
            Hello("张三", SayHiChinese);

            //调用英文打招呼
            Hello("Michael", SayHiEnglish);
        }

        public static void Hello(string name, SayHi delegateSayHi)
        {
            //委托方法的调用
            delegateSayHi(name);
        }

        public static void SayHiChinese(string name)
        {
            Console.WriteLine("{0}，你好！吃了么？", name);
        }

        public static void SayHiEnglish(string name)
        {
            Console.WriteLine("Nice to see you, {0}!", name);
        }
    }
}
